<!--
 * @Description: 我要报修
 * @Author: Ronda
 * @Date: 2022-02-16 09:30:08
 * @LastEditors: Ronda
 * @LastEditTime: 2022-05-23 15:13:16
-->
<template>
  <div>
    <div class="block">
      <div style="font-size:20px; font-weight: bold; line-height: 3;">工程设备</div>
      <el-cascader clearable style="width: 100%;" class="btn" :props="{ label: 'name', value: 'id' }" :options="EngData"
        @change="handleChange"></el-cascader>
      <div style="font-size: 15px; font-weight: bold; line-height: 2;margin-top: 30px;">
        <label>报修原因</label>
      </div>
      <el-input type="textarea" :rows="2" placeholder="请输入报修原因" v-model="params.bill_why">
      </el-input>
      <el-button @click="toSubmit"
        style="margin-top: 20px; background-color: cornflowerblue;color: aqua;">提交</el-button>
    </div>
  </div>
</template>

<script>
import { get,post } from '@/utils/request'
export default {
  data() {
    return {
      textarea: '',
      options: [],
      EngData: [],
      params:{},

    };
  },
  computed: {},
  methods: {
    async toSubmit(){
      let res = await post('/workorder/repairOrder',this.params);
      this.$message({
        type:'success',
        message:res.message
      });
      this.$router.push({
        path:'/am/order/List'
      })
    },
    async getEngDevData(){
      let res = await get('/engineer/findEngineerDeviceTree');
      this.EngData = res.data;
    },
    handleChange(value){
      this.params.engineer_id = value[0];
      this.params.device_id = value[1];
    }
  },
  created() {
    this.getEngDevData();
   },
  mounted() { },
};
</script>
<style lang="scss" scoped>
::v-deep .el-input__inner{
  width: 100%;
}
</style>